/*
 * $Id: bookmarks.h 39 2008-07-11 00:27:47Z dtikhonov $
 *
 * Bookmarking functions.
 */

#ifndef _DHEXVIEW_BOOKMARKS_H_ /* [ */
#define _DHEXVIEW_BOOKMARKS_H_ 1

#include <stdbool.h>
#include <stdint.h>
#include <lua.h>

#define BOOKMARK_NAME_MAX 127

typedef struct {
    const char *name;
    uint64_t cursor;
} bookmark_t;

struct bms {
    bool
    (*get_bookmark_by_name)(struct bms *self, const char *name, bookmark_t *);

    bool
    (*get_bookmark_by_number)(struct bms *self, int number, bookmark_t *);

    int
    (*count)(struct bms *self);

    bool
    (*add_bookmark)(struct bms *self, const char *name, uint64_t cursor);

    void
    (*delete_all)(struct bms *self);

    void
    (*destroy)(struct bms *self);

    void *ctx;
};
typedef struct bms bms_t;

bms_t *
bms_new (lua_State *);

extern bms_t *bms;  // we only have one instance for now

#endif /* ] _DHEXVIEW_BOOKMARKS_H_ */
